<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>AR Tree</title>
    <script src="./assets/aframe.js"></script>
    <script src="./assets/mindar-image.js"></script>
    <script src="./assets/mindar-aframe.js"></script>
    <style>
        body {
            margin: 0;
            padding: 0;
            background: transparent; /* 完全透明 */
            overflow: hidden;
            width: 100vw;
            height: 100vh;
        }
        .a-canvas {
            width: 100vw !important;
            height: 100vh !important;
            display: block;
            background: transparent !important; /* 确保canvas也透明 */
        }
        #loading {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            color: black;
            font-family: Arial, sans-serif;
            z-index: 1000;
        }
    </style>
</head>
<body>
<div id="loading">加载中...</div>

<a-scene
        mindar-image="imageTargetSrc: ./models/card.mind; autoStart: true;"
        embedded
        vr-mode-ui="enabled: false"
        loading-screen="enabled: false"
        renderer="colorManagement: true; antialias: true; alpha: true"
        background="color: transparent; transparent: true" >

<a-assets>
    <a-asset-item id="treeModel" src="./models/real3D.glb"></a-asset-item>
</a-assets>

<!-- 相机配置 -->
<a-camera
        active="true"
        position="0 0 0"
        look-controls="enabled: true"
        wasd-controls="enabled: false"
></a-camera>

<a-entity mindar-image-target="targetIndex: 0">
    <!-- 调整模型位置和大小 -->
    <a-entity
            gltf-model="#treeModel"
            position="0 0 0"
            scale="3 3 3"
            rotation="90 20 25"
    ></a-entity>
</a-entity>

<!-- 增强光照 -->
<a-entity light="type: ambient; color: #FFFFFF; intensity: 0.9"></a-entity>
<a-entity light="type: directional; color: #FFFFFF; intensity: 1.2" position="2 8 5"></a-entity>
<a-entity light="type: point; color: #FFFFFF; intensity: 0.8" position="0 3 0"></a-entity>

</a-scene>

<script>
    // 隐藏加载提示
    document.querySelector('a-scene').addEventListener('loaded', function () {
        document.getElementById('loading').style.display = 'none';
    });
</script>
</body>
</html>